package main.chapter6.interfaces;/**
 * @Author xy
 * @Date 2020/6/20 22:41
 * @Description
 */

import java.util.Arrays;

/**
 * 文件名称： main.chapter6.interfaces.EmployeeTest.java</br>
 * 初始作者： xy</br>
 * 创建日期： 2020/6/20 22:41</br>
 * 功能说明： TODO <br/>
 * =================================================<br/>
 * 修改记录：<br/>
 * 修改作者        日期       修改内容<br/>
 * ================================================<br/>
 * Copyright (c) 2020-2021 .All rights reserved.<br/>
 */
public class EmployeeTest implements Named, Person {
    public static void main(String[] args) {
        Employee[] staff = new Employee[3];
        staff[0] = new Employee("Harry Hacker", 35000);
        staff[1] = new Employee("Carl Cracker", 75000);
        staff[2] = new Employee("Tony Tester", 38000);

        Arrays.sort(staff);

        for (Employee e: staff){
            System.out.println("name="+e.getName()+",salary="+e.getSalary());
        }
    }

    @Override
    public String getName() {
        return Person.super.getName();
    }
}

interface Person{
    default String getName(){
        return "";
    }
}

interface  Named{
    default String getName(){
        return getClass().getName()+"_"+hashCode();
    }
}
